# -*- coding:utf-8 -*-


def fatorial(n: int) -> int:
    if n < 0:
        raise ValueError("Cannot input negative n.\n")
    if n == 0:
        return 1
    else:
        return n * fatorial(n - 1)
